package com.itheima.config;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/*****
 * @Author: 黑马训练营
 * @Description: com.itheima.config
 ****/
@Component
@RabbitListener(queues = "queue2")
public class MessageListener {

    /***
     * 接收延时队列数据
     * @param message
     */
    @RabbitHandler
    public void getMessage(String message){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("接到消息时间："+simpleDateFormat.format(new Date()));
        System.out.println(message);
    }
}
